stream: fix pipeline function tail deadlock - #65559
Conversation
Signed-off-by: Dayun <dlekdbs6530@gmail.com>
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65559 +/- ##
==========================================
+ Coverage 90.05% 90.07% +0.01%
==========================================
Files 751 751
Lines 254420 254430 +10
Branches 47975 47981 +6
==========================================
+ Hits 229121 229169 +48
+ Misses 16483 16437 -46
- Partials 8816 8824 +8
🚀 New features to boost your workflow:
|
|
It looks like the CI run failed, but I don't have access to the Jenkins failure details. Could someone with access please check which test failed and whether it is related to this change? Thanks! |
This comment was marked as outdated.
This comment was marked as outdated.
mcollina
left a comment
There was a problem hiding this comment.
This is on purpose and it matches the normal pipeline behavior. Adding that .resume() can cause data loss in case the end stream is not piped to a destination.
|
Thanks for the clarification. I understand the concern that automatically calling I have one question about the promises variant. When the final function returns an AsyncIterable, The current documentation also lists In this case, would the preferred behavior be to keep the current semantics and treat this as expected behavior, or should the promises variant reject or document an AsyncIterable-returning destination differently? I'd be happy to adjust the PR accordingly. Thanks! |
Fixes: #40685
When the final pipeline entry is a function,
pipelineImpl()creates aninternal
PassThroughproxy. In the promise-based pipeline API, that proxyis not exposed to the user, so its readable side can remain unconsumed.
Once the proxy buffer reaches its high water mark, backpressure prevents
the pipeline from completing and the returned promise never resolves.
Resume the internal proxy when the final pipeline entry is a function.
This also handles the array form of
pipeline()while preserving theexisting behavior for user-provided destination streams.
Tests:
./node test/parallel/test-stream-pipeline.jsmake lint